package com.shujia.day20.lambda7;

import java.util.function.Function;

/*
    java内置函数式接口：函数型接口
    只有函数式接口【有且仅有一个抽象方法】才可以被@FunctionalInterface注解所修饰
    @FunctionalInterface
    public interface Function<T, R> {
        R apply(T t);
    }
 */
public class StaffDemo {
    public static void main(String[] args) {
        Staff s = new Staff("sj1001", "李刚", 18, 35000);
        show1(s, s1 -> s1.getName() + ":真帅！");
    }

    public static void show1(Staff staff, Function<Staff, String> function) {
        String s = function.apply(staff);
        System.out.println(s);
    }
}
